// 写入你的 js 代码
function change_checkbox_val(e) {
    var url = $(e).attr("data-url");
    var ischecked = $(e).is(":checked");
    var value;
    switch (ischecked)
    {
        case true:
            value=1;
            break;
        case false:
            value=2;
            break;
    }
   var load = layer.load(2);
    $.ajax({
        type: "PUT",
        url: url,
        data: {on_sale:value},
        dataType: "json",
        success: function(data){
            layer.closeAll('loading'); //关闭加载层
            if(data.status==1){
                layer.msg(data.msg);
            }
        }
    });
}

